import java.util.HashMap;
import java.util.LinkedList;


public class Element extends Expr {
	private Integer intValue;
	private ElementList listValue;
	
	public Element() {
	}
	
	public Element(Integer intValue) {
		setIntValue(intValue);
	}
	
	public Element(ElementList listValue) {
		setListValue(listValue);
	}

	public Integer getIntValue() {
		return intValue;
	}

	public void setIntValue(Integer intValue) {
		this.intValue = intValue;
	}

	public ElementList getListValue() {
		return listValue;
	}

	public void setListValue(ElementList listValue) {
		this.listValue = listValue;
	}
	
	public boolean isList() {
		return listValue != null;
	}
	
	public boolean isInt() {
		return intValue != null;
	}
	
	@Override
	public String toString() {
		return isInt() ? toStringInt() : toStringList();
	}
	
	@Override
	public Element eval(HashMap<String, Element> nametable, HashMap<String, Proc> functiontable, LinkedList var) {
		return this;
	}
	
	public String toStringInt() {
		return intValue.toString();
	}
	
	public String toStringList() {
		return listValue.toString();
	}
	
	public Element clone() {
		Element newElement = new Element();
		
		newElement.intValue = intValue;
		
		if (listValue != null) {
			newElement.listValue = listValue.clone();
		}
		
		return newElement;
	}
}
